﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BrokerBase.Lib.Policy;

namespace broker.duty.GS
{
    class Class2
    {
        public void Calc2(IPolicyPeriodActing ppa, IDutyActing da)
        {
            if (ppa.SchemePeriodActing.InsurantStates.Contains("身故"))
            {
                if (ppa.Age < 18)
                {
                    da.Value = ppa.TotalFee * 1.5;
                }
                else
                {
                    da.Value = ppa.Amount - ppa.GetDutyTotalValue("成才保险金") - ppa.GetDutyTotalValue("立业保险金") - ppa.GetDutyTotalValue("安家保险金");
                }
                ppa.IsCurrentFinish = true;
            }
        }

        public void Calc2(IPolicyPeriodActing ppa, IDutyActing da)
        {

            if (ppa.Period > 0)
            {
                IPolicyPeriodActing pppa = ppa.PolicyActing.PeriodActings[ppa.Period - 1];

                if (pppa.SchemePeriodActing.HolderStates.Contains("身故") && pppa.Age < 18)
                {
                    ppa.Fee = 0;
                }
            }


            if (ppa.SchemePeriodActing.HolderStates.Contains("身故") && ppa.Age <18)
            {
                
            }
        }

        public void Calc2(IPolicyPeriodActing ppa, IDutyActing da)
        {
            switch (ppa.Age)
            {
                case 15:
                case 16:
                case 17:
                    da.Value = ppa.Amount * 0.1;
                    break;
            }
        }

        public void Calc2(IPolicyPeriodActing ppa, IDutyActing da)
        {
            switch (ppa.Age)
            {
                case 18:
                case 19:
                case 20:
                case 21:
                    da.Value = ppa.Amount * 0.3;
                    break;
            }
        }

        public void Calc2(IPolicyPeriodActing ppa, IDutyActing da)
        {
            if ( ppa.SchemePeriodActing.InsurantStates.Contains("重疾"))
            {
                if (ppa.Period == 0)
                {
                    da.Value = ppa.TotalFee;
                }
                else
                {
                    da.Value = ppa.Amount;
                }
                ppa.IsCurrentFinish = true;
            }
        }

        public void Calc2(IPolicyPeriodActing ppa, IDutyActing da)
        {
            if (ppa.Period > 0)
            {
                IPolicyPeriodActing pppa = ppa.PolicyActing.PeriodActings[ppa.Period - 1];
                if (pppa.SchemePeriodActing.HolderStates.Contains("身故") || pppa.SchemePeriodActing.HolderStates.Contains("全残"))
                {
                    ppa.Fee = 0;
                }
            }
            
        }
    }
}
